{block name=report-classes}
<div class="form">
  <form class="form reports-admin" role="form" id="filter-form">
    {include file='reports/input/filters.tpl'}
			<div class="row">
		<div class="form-group col-sm-6 text-center">
			<label class="" for="from">From:</label> 
			<input style="display:inline-block" type="text" class="form-control dates" value="{'-1 month'|date_format:"%Y-%m-%d"}" name="filter[start_date]" id="rev_start_date" required>
		</div>
		<div class="form-group col-sm-6 text-center">
			<label class="" for="to">To:</label> 
			<input style="display:inline-block" type="text" class="form-control dates" value="{$smarty.now|date_format:"%Y-%m-%d"}" name="filter[end_date]" id="rev_end_date" required>
		</div>
			</div>
      <div class="row">
        <div class="col-sm-12">
		    <a href="javascript:void(0);" onClick="loadRevenueReport($(this).closest('form'));" class="btn btn-info report-green">Report Now</a>
        </div>
      </div>
  </form>
</div> 
<div class="form" id="revenue-report"></div>
<script type="text/javascript">

$(document).ready(function() {

	$("#rev_start_date").datepicker({
		changeMonth : true,
		changeYear : true,
		dateFormat : "dd/mm/yy",
		maxDate : new Date(),
		onSelect : function(selectedDate) {
			$("#rev_end_date").datepicker("option", "minDate", selectedDate);
		}
	});

	$("#rev_end_date").datepicker({
		changeMonth : true,
		changeYear : true,
		dateFormat : "dd/mm/yy",
		maxDate : new Date(),
		onSelect : function(selectedDate) {
			$("#rev_start_date").datepicker("option", "maxDate", selectedDate);
		}
	});
});
function loadRevenueReport(form) {
    $('body').css('cursor', 'wait');
    $('#revenue-report').html('');
    $.ajax({
      type : "POST",
      url : "/admin/includes/processes/processes-reports.php",
      cache : false,
      data : "action=revenuelist&"+$(form).serialize(),
      dataType : "json",
      success : function(data, textStatus) {
        try {
          $('#revenue-report').prepend(data['html']);
          eval(data['javascript']);
          $('body').css('cursor', 'default');
        } catch (err) {
          $('body').css('cursor', 'default');
        }
      }
    });
}
</script>
{/block} 


